package com.sinping.qh.query.plan;

import com.sinping.qh.query.base.Operator;
import com.sinping.qh.query.base.QueryParams;
import com.sinping.qh.service.common.CommonDbConst;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author zhangjin
 * @create 2018/5/30
 */
@Data
public class CheckPlanByAppQuery implements QueryParams,Serializable {

    static Map<String, String> aliasMap = new HashMap<>();
    static Map<String, Operator> operatorMap = new HashMap<>();

    /**
     * 检查人
     */
    private String checkUserId;

    /**
     * 检查记录id
     */
    private String checkPlanId;

    static {
        aliasMap.put("checkUserId","check_user._id");
        aliasMap.put("checkPlanId","_id");

        operatorMap.put("checkUserId",Operator.in);
        operatorMap.put("checkPlanId",Operator.eq);

    }

    @Override
    public String getAlias(String fieldName) {
        return aliasMap.getOrDefault(fieldName, fieldName);
    }

    @Override
    public Operator getOperators(String fieldName) {
        return operatorMap.getOrDefault(fieldName, Operator.eq);
    }
}
